<template>
  <div class="view-content-box py-20">
    <LoadList
      :query-params="queryParams"
      :loadingData="postAgentShopOrderPage"
      class="view-content"
    >
      <template #list="{ list }">
        <div class="device-list">
          <div
            v-for="(item, index) in list"
            :key="item.id || index"
            class="d-flex"
          >
            <div class="item-lf">
              <div class="order-no">订单编号：{{ item.orderNo }}</div>
              <div class="msg-list">
                <div>所属商户：{{ item.shopName }}</div>
                <div>订单日期：{{ item.createTime }}</div>
                <div>
                  订单状态：{{
                    item.status == 0
                      ? "使用中"
                      : item.status == 1
                      ? "紧急停机"
                      : item.status == 2
                      ? "待评价"
                      : "已完成"
                  }}
                </div>
                <div>套餐类型：{{ item.packageName }}</div>
              </div>
            </div>
            <div class="item-ri">
              <div class="num-title">信用分消耗</div>
              <div class="num">{{ item.amount }}</div>
            </div>
          </div>
        </div>
      </template>
    </LoadList>
  </div>
</template>

<script setup>
import { postMpDeviceStatistics, postAgentShopOrderPage } from "@/api/index";
import { onMounted } from "vue";
const router = useRouter();
const route = useRoute();
const queryParams = reactive({
  shopId: route.query.shopId,
  deviceId: route.query.id,
});
const detail = ref({
  deviceNum: "112",
  errorNum: "112",
});
const area = ref("");
const getStatistics = () => {
  postMpDeviceStatistics().then((res) => {
    console.log(res);
    detail.value = res.data;
  });
};

onMounted(() => {
  getStatistics();
  // getList();
});
</script>

<style lang="less" scoped>
.head {
  width: 100%;
  height: 276px;
  background: url("@/assets/bg1.png") no-repeat center;
  position: relative;
  padding-top: 28px;
  .title {
    font-size: 40px;
    color: #151515;
    font-weight: 600;
    text-align: center;
  }
  .search-box {
    position: absolute;
    bottom: 36px;
    width: 100%;
  }
}
.area-box {
  font-size: 32px;
  color: #151515;
}
.address-icon {
  width: 36px;
  height: 36px;
}
.area-msg {
  font-size: 24px;
  color: #151515;
  line-height: 34px;
  display: flex;
  align-items: center;
  margin-left: 10px;
  .icon {
    width: 24px;
    height: 24px;
  }
}

.type-list {
  display: flex;
  gap: 20px;
  > .device-type {
    flex: 1;
    // height: 250px;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    &:first-child {
      background: #b5d4ff;
    }
    &:last-child {
      background: #fedc00;
    }
    .num {
      font-size: 46px;
      font-weight: 600;
      margin-bottom: 24px;
    }
    .type {
      font-size: 30px;
    }
  }
}
.add-btn {
  width: 100%;
  height: 70px;
  line-height: 70px;
  text-align: center;
  background: #fff;
  border-radius: 30px;
  color: #000;
  font-size: 32px;
  margin: 30px 0;
}
.device-list {
  display: flex;
  // gap: 20px;
  padding: 0 32px;
  flex-wrap: wrap;
  > div {
    width: 100%;
    height: 280px;
    color: #969696;
    font-size: 26px;
    background: #fff;
    // border-radius: 10px;
    // text-align: center;
    margin-bottom: 24px;

    border-radius: 16px;
    overflow: hidden;

    // &:nth-child(2n + 1) {
    //   margin-right: 30px;
    // }
  }
  .item-lf {
    flex: 1;
    padding: 0;
    .order-no {
      font-weight: 600;
      font-size: 26px;
      color: #151515;
      padding: 20px;
      border-bottom: 1px solid #e8e8e8;
    }
    .msg-list {
      padding: 20px;
      flex: 1;
      display: flex;
      flex-direction: column;
      font-size: 26px;
      color: #6c6c6c;
      > div:not(:last-child) {
        margin-bottom: 8px;
      }
    }
  }
  .item-ri {
    padding-top: 28px;
    width: 192px;
    background: url("@/assets/bg_shebei.png") no-repeat center;
    text-align: center;
    .num-title {
      font-weight: 600;
      font-size: 26px;
      color: #ffffff;
      margin-bottom: 36px;
    }
    .num {
      font-weight: 600;
      font-size: 78px;
      color: #ff4e00;
    }
  }

  .status {
    color: #6a6a6a;
    > .error {
      color: #e55f6a;
    }
  }
}
</style>
